﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using EPND.Model;

namespace EPNDWeb.Net.BigFileUpload
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class SendFileDataStream : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            FilePositionInfos model = new FilePositionInfos();

            context.Response.ContentType = "text/plain";
            model = SetFilePositionInfo(context);
            context.Response.Write(model.FileName + "::" + model.FilePath);
            context.Response.End();
        }

        private FilePositionInfos SetFilePositionInfo(HttpContext context)
        {
            string strTmp = string.Empty;
            FilePositionInfos _model = new FilePositionInfos();
            _model.Postion = long.Parse(context.Request["FilePositon"]);
            _model.FileAccesstime = DateTime.Parse(context.Request["FileAccesstime"]);
            _model.FileCreatetime = DateTime.Parse(context.Request["FileCreatetime"]);
            _model.FileBuildtime = DateTime.Parse(context.Request["FileBuildtime"]);
            _model.FileIsDel = false;
            _model.FileModifytime = DateTime.Parse(context.Request["FileModifytime"]);
            _model.FileName = context.Request["FileName"];
            _model.FilePath = context.Request["FilePath"];
            _model.FileSize = long.Parse(context.Request["FileSize"]);
            //strTmp = context.Request["FileType"];
            _model.FileType = bool.Parse(context.Request["FileType"]);
            _model.ID = 0;
            _model.VersionHistoryMaxID = 0;
            _model.VersionHistoryMaxNum = 0;
            _model.SecurityCheckCode = context.Request["SecurityCheckCode"];
            _model.ServerRoot = @"e:\";

            return _model;
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}